﻿using System;
using NLog;
using System.Collections;
using DAL;
using System.Web.Script.Serialization;
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Web.UI.DataVisualization.Charting;

public partial class Admin_Report : ParentPage
{
    #region Variables
    private static Logger _logger = LogManager.GetCurrentClassLogger();
    #endregion

    #region pageload
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            /********************************Get Duration from To*************************************************/
            //DateTime startingDate = DateTime.Now.AddDays(-10);
            //DateTime endingDate = DateTime.Now;
            //ArrayList objArrayList = new ArrayList();
            //for (DateTime date = startingDate; date <= endingDate; date = date.AddDays(1))
            //    objArrayList.Add(date);

            /********************************Get Duration from To*************************************************/
            Chart1.Series["Series1"].ChartType = SeriesChartType.Column;
            Chart1.Series["Series1"]["DrawingStyle"] = "Emboss";
            Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
            Chart1.Series["Series1"].IsValueShownAsLabel = true;
            FillData(); 
        }
        catch (Exception ex)
        {
            _logger.Error("Admin_Report:::Page_Load:::" + ex.Message);
        }
    }
    #endregion

    #region Methods
    private void FillData()
    {
        //DataTable dt = new DataTable();
        //DataColumn dc;

        //dc = new DataColumn();
        //dc.ColumnName = "Name";
        //dt.Columns.Add(dc);
        //dc = new DataColumn();
        //dc.ColumnName = "Age";
        //dt.Columns.Add(dc);

        //DataRow dr;
        //dr = dt.NewRow();
        //dr["Name"] = "Sunil Gurjar";
        //dr["Age"] = "27";
        //dt.Rows.Add(dr);
        //dr = dt.NewRow();
        //dr["Name"] = "Anil Kumar";
        //dr["Age"] = "32";
        //dt.Rows.Add(dr);
        //dr = dt.NewRow();
        //dr["Name"] = "Amit Kumar";
        //dr["Age"] = "35";
        //dt.Rows.Add(dr);
        //dr = dt.NewRow();
        //dr["Name"] = "Narendra";
        //dr["Age"] = "32";
        //dt.Rows.Add(dr);
        //dr = dt.NewRow();
        //dr["Name"] = "Sudhir";
        //dr["Age"] = "16";
        //dt.Rows.Add(dr);
        //dr = dt.NewRow();
        //dr["Name"] = "Pooja";
        //dr["Age"] = "25";
        //dt.Rows.Add(dr);
        DateTime dtForm = DateTime.Now.AddMonths(-1);
        DateTime dtTo = DateTime.Now;
        ManageArticls objManageArticls = new ManageArticls();
        Chart1.DataSource = objManageArticls.ArticlsReport(dtForm, dtTo).Tables[0];
        Chart1.Series["Series1"].XValueMember = "CreateDateArt";
        Chart1.Series["Series1"].YValueMembers = "CountArt";
        Chart1.DataBind();
    }
    #endregion
}